// 折线图配置
function barOption(data) {
  let xInterval = 0;
  let xRotate = 0;
  let xData = data.xData;

  // 旋转x轴标签
  if (xData[0].length >= 5) {
    xRotate = 45;
  }

  // 间隔隐藏部分x轴标签
  let xlen = xData.length;
  while (xlen > 15) {
    xInterval++;
    xlen -= 15;
  }

  // 图表内容配置项
  const option = {
    legend: {
      top: 'top',
      left: 'center',
      z: 100
    },
    grid: {
      containLabel: true
    },
    tooltip: {
      show: true,
      trigger: 'axis'
    },
    xAxis: {
      type: 'category',
      boundaryGap: false,
      data: xData,
      axisLabel: {
        interval: xInterval,
        rotate: xRotate
      }
    },
    yAxis: {
      x: 'center',
      type: 'value',
      splitLine: {
        lineStyle: {
          type: 'dashed'
        }
      },
      axisLabel: {
        interval: 2
      },
      minInterval: 1,
    },
    series: data.yData
  }
  return option
}

// 其他图表的配置...

module.exports = {
  barOption
}